home *** CD-ROM | disk | FTP | other *** search
- global gEnvironmentSound, gOBJECTSE, gObjects, gStates, NULLrect, gHotRects, gScreenstate, gCursorlist, gWorld, gGlobal, sQTSPRITE, sQTCharSprite
-
- on trunc number
- set newNumber to number + 0.5
- if integer(newNumber) > integer(number) then
- return integer(number)
- else
- return integer(number) - 1
- end if
- end
-
- on carDrive gasStationNum
- if the shiftDown and (gGlobal = 1) and (gasStationNum = 15) then
- doGoToFork()
- else
- set carMapObj to getaProp(gObjects, #carMap)
- set curScale to getaProp(carMapObj, #curScale)
- set curZone to getaProp(carMapObj, #curZone) / power(5, 3 - curScale)
- set curZone to trunc(curZone)
- set nextStationZone to getaProp(getaProp(gObjects, value("#carMapGasStn" & gasStationNum)), #zone)
- if nextStationZone <= curZone then
- exit
- end if
- set fuelLevel to getaProp(getaProp(gObjects, #CarGasGauge), #fuelLevel)
- if fuelLevel = 0 then
- Jumptokey(#E01)
- exit
- end if
- set keyFrme1 to value("#EG" & curScale)
- set withinRangeList to getOne(getaProp(getaProp(carMapObj, #gasWithinRnge), value("#level" & curScale)), curZone)
- set newZone to integer(getaProp(carMapObj, #curZone) + (fuelLevel * power(5, 3 - curScale)))
- setaProp(carMapObj, #curZone, newZone)
- if (fuelLevel < 5) or (withinRangeList = 0) then
- set keyFrme2 to value("#E" & curScale & fuelLevel)
- set newDashCast to the number of cast string("E" & curScale & fuelLevel & ".pct")
- setaProp(getaProp(gObjects, #CarGasGauge), #towLength, fuelLevel)
- setaProp(getaProp(gObjects, #carEmerPar), #State, #stranded)
- set runoutCount to getaProp(getaProp(gObjects, #CarGasGauge), #runoutCount) + 1
- MakeDynamic(#CarGasGauge, #runoutCount, runoutCount)
- if runoutCount < 5 then
- set State to value("#E03tow" & runoutCount)
- else
- set State to #E03tow6
- end if
- MakeDynamic(#TowTruckDriverQT, #State, State)
- MakeDynamic(#TowTruckDriverQT, #DisplayState, State)
- else
- if (curScale = 1) and (curZone = 10) then
- set keyFrme2 to #EFK
- set newDashCast to the number of cast "EFK.pct"
- set initList to [#lookAtPelletDispenser]
- set killList to [#carLookLeft, #carLookRight]
- changeHotSpots(initList, killList, #false)
- setaProp(getaProp(gObjects, #carEmerPar), #State, #off)
- else
- set keyFrme2 to value("#E" & curScale & 6)
- set newDashCast to the number of cast ("EG" & curScale & ".pct")
- setaProp(getaProp(gObjects, #CarGasGauge), #towLength, 0)
- set initList to [#carLookRight]
- set killList to []
- changeHotSpots(initList, killList, #false)
- setaProp(getaProp(gObjects, #carEmerPar), #State, #off)
- setaProp(getaProp(gObjects, #GasManQT), #droveOrTowed, #drove)
- end if
- end if
- set movieLength to the duration of cast (keyFrme1 & "_" & keyFrme2 & ".mov") - 20
- setaProp(getaProp(gObjects, #MapCarGasGauge), #movieTimePerZone, movieLength / fuelLevel)
- if not (the shiftDown) then
- set the locH of sprite getaProp(getaProp(gObjects, #transCarDashView), #SpriteNum) to 280
- set the locH of sprite getaProp(getaProp(gObjects, #carDashPict), #SpriteNum) to 280
- set the locH of sprite getaProp(getaProp(gObjects, #MapCarGasGauge), #SpriteNum) to 283
- end if
- set dashObj to getaProp(gObjects, #carDashView)
- setaProp(getaProp(dashObj, #cast), #UP, newDashCast)
- set dashObj to getaProp(gObjects, #TowCarDashView)
- setaProp(getaProp(dashObj, #cast), #UP, newDashCast)
- MakeDynamic(#TowCarDashView, #cast, getaProp(getaProp(gObjects, #TowCarDashView), #cast))
- set newDashCast to the number of cast string("EG" & curScale & ".pct")
- set dashSprite to getaProp(getaProp(gObjects, #transCarDashView), #SpriteNum)
- set the castNum of sprite dashSprite to newDashCast
- updateStage()
- genExitKFE(keyFrme1, keyFrme2, "Drive")
- MakeDynamic(#CarDash, #State, #off)
- changeGasGauge(1, #false)
- end if
- end
-
- on doGoToFork
- setaProp(getaProp(gObjects, #carMap), #curZone, 15 * 25)
- set newDashCast to the number of cast "EFK.pct"
- set initList to [#lookAtPelletDispenser]
- set killList to [#carLookLeft, #carLookRight]
- changeHotSpots(initList, killList, #false)
- setaProp(getaProp(gObjects, #carEmerPar), #State, #off)
- set dashObj to getaProp(gObjects, #carDashView)
- setaProp(getaProp(dashObj, #cast), #UP, newDashCast)
- MakeDynamic(#CarDash, #State, #off)
- setaProp(getaProp(gObjects, #CarGasGauge), #fuelLevel, 0)
- changeGasGauge(1, #false)
- Jumptokey(#E01)
- stopsound("E01idle.aif")
- abort()
- end
-
- on putLocs
- put the loc of sprite 20 & " ΓÇóLoc of DashViewΓÇó"
- put the rect of sprite 48 & " ΓÇóRect of 48ΓÇó"
- put the frame & " ΓÇócur Frame NumΓÇó"
- end
-
- on DoTransitionForE LastKeyRef, NextKeyRef
- SetTransMovie(LastKeyRef, NextKeyRef)
- set gPlayingQT to 1
- onOffScreenCursor(0)
- set the movieTime of sprite sQTSPRITE to 0
- set the rect of sprite sQTSPRITE to rect(0, 0, 560, 188)
- set gLastCursor to getaProp(gCursorlist, #NullCursor)
- end
-
- on genExitKFE LastKeyRef, NextKeyRef, driveOrTow
- set the movieRate of sprite sQTCharSprite to 0
- set the loc of sprite sQTCharSprite to point(-9999, -9999)
- set func to getaProp(getaProp(gCurKeyList, #FUNCTIONS), #exit)
- if func <> #NOEXIT then
- do(string(func))
- end if
- setKFGlobals(#E01)
- if the shiftDown then
- changeGasGauge(1, #false)
- setaProp(getaProp(gObjects, #CarGasGauge), #fuelLevel, 0)
- go("KeyFrame")
- else
- DoTransitionForE(LastKeyRef, NextKeyRef)
- if driveOrTow = "Drive" then
- go("DriveQT")
- set objsToDel to [#carMapSeg1, #carMapSeg2, #carMapSeg3, #carMapURHere, #carMapBg, #carMapPanLft, #carMapPanRt, #carMapZoomIn, #carMapZoomOut, #scaleDesc, #distanceIndicator, #carMapGasStn1, #carMapGasStn2, #carMapGasStn3, #carMapGasStn4, #carMapGasStn5, #carMapGasStn6, #carMapGasStn7, #carMapGasStn8, #carMapGasStn9, #carMapGasStn10, #carMapGasStn11, #carMapGasStn12, #carMapGasStn13, #carMapGasStn14, #carMapGasStn15]
- DelObjects(objsToDel)
- else
- playSound("E01towgo.aif", #File, 1)
- set whichChannel to the result
- repeat while soundBusy(whichChannel) = 1
- end repeat
- go("TowQT")
- end if
- playSound("E01drive.aif", #cast, 0)
- end if
- stopsound("E01idle.aif")
- end
-
- on DocarMapPanLft
- scrollMap("left")
- end
-
- on DocarMapPanRt
- scrollMap("right")
- end
-
- on DocarMapZoomIn
- if getaProp(getaProp(gObjects, #carMap), #curScale) = 3 then
- exit
- end if
- changeScale("plus")
- end
-
- on DocarMapZoomOut
- if getaProp(getaProp(gObjects, #carMap), #curScale) = 1 then
- exit
- end if
- changeScale("minus")
- end
-
- on setMapPos
- set carMap to getaProp(gObjects, #carMap)
- set OBj to getaProp(gObjects, #carMapPanLft)
- set the loc of sprite getaProp(OBj, #SpriteNum) to getaProp(OBj, #loc)
- set curHotRect to getAt(getaProp(OBj, #Hotrect), 1)
- setaProp(getaProp(gHotRects, value(getaProp(OBj, #SpriteNum) & "01")), #rect, curHotRect)
- set OBj to getaProp(gObjects, #carMapPanRt)
- set the loc of sprite getaProp(OBj, #SpriteNum) to getaProp(OBj, #loc)
- set curHotRect to getAt(getaProp(OBj, #Hotrect), 1)
- setaProp(getaProp(gHotRects, value(getaProp(OBj, #SpriteNum) & "01")), #rect, curHotRect)
- set newURHereLoc to getaProp(getaProp(gObjects, #carMapURHere), #loc)
- set the loc of sprite getaProp(getaProp(gObjects, #carMapURHere), #SpriteNum) to newURHereLoc
- set mapV to getaProp(carMap, #mapsV)
- set startcast to getaProp(carMap, #startcast)
- set map1H to getaProp(carMap, #map1H)
- repeat with X = 0 to 2
- set whichMap to getaProp(gObjects, value("#carMapSeg" & X + 1))
- set mapSpriteNum to getaProp(whichMap, #SpriteNum)
- set the castNum of sprite mapSpriteNum to startcast + X
- set the locH of sprite mapSpriteNum to map1H + (X * 208)
- end repeat
- updateMapHtRcts()
- end
-
- on setMapVar
- set carMap to getaProp(gObjects, #carMap)
- set curScale to getaProp(carMap, #curScale)
- set curZone to getaProp(carMap, #curZone) / power(5, 3 - curScale)
- set curZone to trunc(curZone)
- set curZone to trunc(curZone)
- set dotOffset to getAt(getaProp(getaProp(carMap, #levelHLocs), value("#level" & curScale)), curZone + 1)
- set dotV to getAt(getaProp(getaProp(carMap, #levelVLocs), value("#level" & curScale)), curZone + 1)
- set scaleEnd to 2080 * power(5, curScale - 2)
- if dotOffset < 209 then
- set dotH to dotOffset + 72
- set startcast to getaProp(getaProp(carMap, #levelStrtCast), value("#level" & curScale))
- set map1H to 176
- set OBj to getaProp(gObjects, #carMapPanLft)
- setaProp(OBj, #Hotrect, [NULLrect])
- setaProp(OBj, #loc, point(-9999, 147))
- set OBj to getaProp(gObjects, #carMapPanRt)
- setaProp(OBj, #Hotrect, [getAt(getaProp(OBj, #hotRect2), 1)])
- setaProp(OBj, #loc, point(513, 147))
- else
- if dotOffset > (scaleEnd - 209) then
- set dotH to 488 - (scaleEnd - dotOffset)
- set startcast to getaProp(getaProp(carMap, #levelEndCast), value("#level" & curScale)) - 2
- set map1H to -32
- set OBj to getaProp(gObjects, #carMapPanLft)
- setaProp(OBj, #Hotrect, [getAt(getaProp(OBj, #hotRect2), 1)])
- setaProp(OBj, #loc, point(47, 147))
- set OBj to getaProp(gObjects, #carMapPanRt)
- setaProp(OBj, #Hotrect, [NULLrect])
- setaProp(OBj, #loc, point(-9999, 147))
- else
- set startcast to getaProp(getaProp(carMap, #levelStrtCast), value("#level" & curScale)) + integer(dotOffset / 208) - 1
- set map1H to 176 - (dotOffset mod 208)
- set adjustment to map1H mod getaProp(carMap, #scrollStepSize)
- set map1H to map1H - adjustment
- set dotH to 280 - adjustment
- set OBj to getaProp(gObjects, #carMapPanLft)
- setaProp(OBj, #Hotrect, [getAt(getaProp(OBj, #hotRect2), 1)])
- setaProp(OBj, #loc, point(47, 147))
- set OBj to getaProp(gObjects, #carMapPanRt)
- setaProp(OBj, #Hotrect, [getAt(getaProp(OBj, #hotRect2), 1)])
- setaProp(OBj, #loc, point(513, 147))
- end if
- end if
- if curScale = 1 then
- set map1H to 176
- set startcast to getaProp(getaProp(carMap, #levelStrtCast), #level1)
- set OBj to getaProp(gObjects, #carMapPanLft)
- setaProp(OBj, #Hotrect, [NULLrect])
- setaProp(OBj, #loc, point(-9999, 147))
- set OBj to getaProp(gObjects, #carMapPanRt)
- setaProp(OBj, #Hotrect, [NULLrect])
- setaProp(OBj, #loc, point(-9999, 147))
- end if
- setaProp(getaProp(gObjects, #carMapURHere), #loc, point(dotH, dotV))
- set mapV to getaProp(carMap, #mapsV)
- repeat with X = 0 to 2
- set whichMap to getaProp(gObjects, value("#carMapSeg" & X + 1))
- set mapSpriteNum to getaProp(whichMap, #SpriteNum)
- setaProp(getaProp(whichMap, #cast), #UP, startcast + X)
- setaProp(whichMap, #loc, point(map1H + (X * 208), mapV))
- end repeat
- setaProp(carMap, #startcast, startcast)
- setaProp(carMap, #map1H, map1H)
- set seg1Obj to getaProp(gObjects, #carMapSeg1)
- set map1SprtLft to map1H - 104
- set seg1Cast to getaProp(getaProp(seg1Obj, #cast), #UP)
- set startcast to getaProp(carMap, #levelStrtCast)
- set leftEdgeH to map1SprtLft - ((seg1Cast - getaProp(startcast, value("#level" & curScale))) * 208)
- setaProp(carMap, #leftEdge, leftEdgeH)
- updateMapHtRectVars()
- end
-
- on scrollMap whichWay
- set carMap to getaProp(gObjects, #carMap)
- set curScale to getaProp(carMap, #curScale)
- if whichWay = "right" then
- set direction to -1
- set edgeLoc to getaProp(carMap, #lftLimit)
- set edgeCast to getaProp(getaProp(carMap, #levelEndCast), value("#level" & curScale))
- set OBj to getaProp(gObjects, #carMapPanLft)
- setaProp(getaProp(gHotRects, value(getaProp(OBj, #SpriteNum) & "01")), #rect, getAt(getaProp(OBj, #hotRect2), 1))
- set the locH of sprite getaProp(OBj, #SpriteNum) to 47
- setaProp(OBj, #loc, point(47, 147))
- set scrollObj to getaProp(gObjects, #carMapPanRt)
- else
- set direction to 1
- set edgeLoc to getaProp(carMap, #rtLimit)
- set edgeCast to getaProp(getaProp(carMap, #levelStrtCast), value("#level" & curScale))
- set OBj to getaProp(gObjects, #carMapPanRt)
- setaProp(getaProp(gHotRects, value(getaProp(OBj, #SpriteNum) & "01")), #rect, getAt(getaProp(OBj, #hotRect2), 1))
- set the locH of sprite getaProp(OBj, #SpriteNum) to 513
- setaProp(OBj, #loc, point(513, 147))
- set scrollObj to getaProp(gObjects, #carMapPanLft)
- end if
- set the castNum of sprite getaProp(scrollObj, #SpriteNum) to getaProp(getaProp(scrollObj, #cast), #down)
- set URHereSprteNum to getaProp(getaProp(gObjects, #carMapURHere), #SpriteNum)
- set atEdge to 0
- set OffsetH to 3 * direction * -1
- repeat while the stillDown
- repeat with X = 1 to 3
- set whichMap to getaProp(gObjects, value("#carMapSeg" & X))
- set whichSprite to getaProp(whichMap, #SpriteNum)
- set curH to the locH of sprite whichSprite
- set newH to curH + (direction * 16)
- set curCast to the castNum of sprite whichSprite
- set the locH of sprite whichSprite to newH
- setaProp(whichMap, #loc, point(newH, 156))
- if (newH = edgeLoc) or (curH = edgeLoc) then
- if (curCast + (2 * direction * -1)) <> edgeCast then
- set newCastNum to curCast + OffsetH
- set the castNum of sprite whichSprite to newCastNum
- setaProp(getaProp(whichMap, #cast), #UP, newCastNum)
- set newCastH to the locH of sprite whichSprite + (getaProp(carMap, #offset) * OffsetH)
- set the locH of sprite whichSprite to newCastH
- setaProp(whichMap, #loc, point(newCastH, 156))
- next repeat
- end if
- if direction = -1 then
- set OBj to getaProp(gObjects, #carMapPanRt)
- setaProp(getaProp(gHotRects, value(getaProp(OBj, #SpriteNum) & "01")), #rect, NULLrect)
- set the locH of sprite getaProp(OBj, #SpriteNum) to -9999
- setaProp(OBj, #loc, point(-9999, 147))
- else
- set OBj to getaProp(gObjects, #carMapPanLft)
- setaProp(getaProp(gHotRects, value(getaProp(OBj, #SpriteNum) & "01")), #rect, NULLrect)
- set the locH of sprite getaProp(OBj, #SpriteNum) to -9999
- setaProp(OBj, #loc, point(-9999, 147))
- end if
- set atEdge to 1
- end if
- end repeat
- set newDotH to the locH of sprite URHereSprteNum + (direction * 16)
- set the locH of sprite URHereSprteNum to newDotH
- set leftEdgeH to getaProp(carMap, #leftEdge) + (direction * 16)
- setaProp(carMap, #leftEdge, leftEdgeH)
- updateStage()
- if atEdge = 1 then
- exit repeat
- end if
- end repeat
- set the castNum of sprite getaProp(scrollObj, #SpriteNum) to getaProp(getaProp(scrollObj, #cast), #UP)
- updateStage()
- updateMapHtRectVars()
- updateMapHtRcts()
- end
-
- on changeScale plusOrMinus
- set carMap to getaProp(gObjects, #carMap)
- set smallRectSprt to getaProp(getaProp(gObjects, #smallRect), #SpriteNum)
- set mapRectSprt to getaProp(getaProp(gObjects, #mapRect), #SpriteNum)
- set the rect of sprite smallRectSprt to rect(274, 153, 286, 162)
- set the rect of sprite mapRectSprt to rect(70, 19, 489, 294)
- if plusOrMinus = "plus" then
- set newScale to getaProp(carMap, #curScale) + 1
- set startRect to smallRectSprt
- set endRect to mapRectSprt
- else
- set newScale to getaProp(carMap, #curScale) - 1
- set startRect to mapRectSprt
- set endRect to smallRectSprt
- end if
- MakeDynamic(#carMap, #curScale, newScale)
- changeMultistate(newScale, #scaleDesc)
- changeMultistate(newScale, #distanceIndicator)
- setMapVar()
- setMapPos()
- zoomBox(startRect, endRect, 3)
- updateStage()
- updateMapHtRectVars()
- updateMapHtRcts()
- end
-
- on updateMapHtRectVars
- set carMap to getaProp(gObjects, #carMap)
- set leftEdge to getaProp(carMap, #leftEdge)
- set curScale to getaProp(carMap, #curScale)
- set levels to [1, 2, 3]
- deleteAt(levels, curScale)
- set hotRectLists to getaProp(carMap, #levelHotRects)
- set moveHotRects to getAt(hotRectLists, curScale)
- set howmany to count(moveHotRects)
- set mapRect to getaProp(carMap, #mapRect)
- repeat with X = 1 to howmany
- set gasStationNum to getAt(moveHotRects, X)
- set gasStationObj to getaProp(gObjects, value("#carMapGasStn" & gasStationNum))
- set currect to getAt(getaProp(gasStationObj, #hotRect2), 1)
- set newRect to intersect(offset(currect, leftEdge - 72, 0), mapRect)
- MakeDynamic(getaProp(gasStationObj, #RefName), #Hotrect, [newRect])
- end repeat
- repeat with X = 1 to 2
- set whichRectList to getAt(hotRectLists, getAt(levels, X))
- set howmany to count(whichRectList)
- repeat with z = 1 to howmany
- set gasStationObj to getaProp(gObjects, value("#carMapGasStn" & getAt(whichRectList, z)))
- MakeDynamic(getaProp(gasStationObj, #RefName), #Hotrect, [NULLrect])
- end repeat
- end repeat
- end
-
- on updateMapHtRcts
- set carMap to getaProp(gObjects, #carMap)
- set curScale to getaProp(carMap, #curScale)
- set levels to [1, 2, 3]
- deleteAt(levels, curScale)
- set hotRectLists to getaProp(carMap, #levelHotRects)
- set moveHotRects to getAt(hotRectLists, curScale)
- set howmany to count(moveHotRects)
- set mapRect to getaProp(carMap, #mapRect)
- repeat with X = 1 to howmany
- set gasStationNum to getAt(moveHotRects, X)
- set gasStationObj to getaProp(gObjects, value("#carMapGasStn" & gasStationNum))
- set currect to getAt(getaProp(gasStationObj, #Hotrect), 1)
- setaProp(getaProp(gHotRects, value(string(59 + gasStationNum) & "01")), #rect, currect)
- end repeat
- repeat with X = 1 to 2
- set whichRectList to getAt(hotRectLists, getAt(levels, X))
- set howmany to count(whichRectList)
- repeat with z = 1 to howmany
- setaProp(getaProp(gHotRects, value(string(59 + getAt(whichRectList, z)) & "01")), #rect, NULLrect)
- end repeat
- end repeat
- end
-
- on changeHotSpots initList, killList, onFrame
- set z to count(initList)
- repeat with X = 1 to z
- set OBj to getaProp(gObjects, getAt(initList, X))
- set Hotrect to getAt(getaProp(OBj, #hotRect2), 1)
- set whichHotRect to value(getaProp(OBj, #SpriteNum) & "01")
- if onFrame = #true then
- setaProp(getaProp(gHotRects, whichHotRect), #rect, Hotrect)
- end if
- MakeDynamic(getaProp(OBj, #RefName), #Hotrect, value("[" & Hotrect & "]"))
- end repeat
- set z to count(killList)
- repeat with X = 1 to z
- set OBj to getaProp(gObjects, getAt(killList, X))
- set whichHotRect to value(getaProp(OBj, #SpriteNum) & "01")
- if onFrame = #true then
- setaProp(getaProp(gHotRects, whichHotRect), #rect, NULLrect)
- end if
- MakeDynamic(getaProp(OBj, #RefName), #Hotrect, value("[" & NULLrect & "]"))
- end repeat
- end
-